using System.Collections;
using System.Collections.Generic;
using TMPro;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;

namespace Demo.Res 
{
    public static class ResourcesMgr
    {

        private static Dictionary<int, Sprite> sprDic;

        static ResourcesMgr()
        {
            var sprArray = Resources.LoadAll<Sprite>("2048Atlas");
            sprDic = new Dictionary<int, Sprite>();
            foreach (var spr in sprArray)
            {
                var key = int.Parse(spr.name);
                sprDic.Add(key, spr);
            }
        }

        public static Sprite GetSprite(int id) 
        {
            return sprDic[id];
        }
    }
}